package com.smartfactory.sail.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smartfactory.sail.entity.OperLog;
import com.smartfactory.sail.mapper.OperLogMapper;
import com.smartfactory.sail.service.IOperLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smartfactory.sail.utils.PageUtils;
import com.smartfactory.sail.vo.PageParam;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 王巨壁
 * @since 2019-08-27
 */
@Service
public class OperLogServiceImpl extends ServiceImpl<OperLogMapper, OperLog> implements IOperLogService {

    private OperLogMapper operLogMapper;

    public OperLogServiceImpl(OperLogMapper operLogMapper) {
        this.operLogMapper = operLogMapper;
    }

    @Override
    public IPage<OperLog> getOperLogPage(PageParam pageParam, Map<String, Object> queryParam) {
        Page<OperLog> page = new Page<>();
        PageUtils.createPage(page, pageParam);
        QueryWrapper<OperLog> query = new QueryWrapper<>();
        query.allEq(queryParam);
        return operLogMapper.getOperLogPage(page, query);
    }
}
